package com.admin.bank.controller;

import com.admin.bank.service.ArBankcardService;
import com.client.model.vo.common.Result;

import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * @Author：刘文举
 * @DateTime： 2024/4/2 18:51
 * @PackageName: com.service.bank.controller
 * @ClassName: BankControler
 */
//用户充值
@RestController
@RequestMapping("/airui/api/bank")
public class BankController {





        @Autowired
        private ArBankcardService arBankcardService;

        @Autowired
        private RedisTemplate<String,String> redisTemplate;

        /**
         * 返回当前用户的银行卡信息
         */
        @GetMapping("/findBank")
        @Operation(summary = "获取当前用户信息")
        public Result findBank(@RequestHeader(name = "token") String token) {
            return arBankcardService.findBank(token);
        }

        /**
         * 充值
         * @param
         * @param price
         * @return
         */
        @PostMapping("/savePrice")
        @Operation(summary = "用户充值")
        public Result savePrice(@RequestParam("price") BigDecimal price,
                                @RequestParam("bankCard")String bankCard) {
            return arBankcardService.savePrice(bankCard,price);
        }


}
